package entities.reports;

import entities.User;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * Trabalho PD - 2014/2015
 * @author a21210380 a21210392
 */
@Entity
@Table(name = "reported_user")
@NamedQueries({
    @NamedQuery(name = "ReportedUser.findAll", query = "SELECT r FROM ReportedUser r"),
    @NamedQuery(name = "ReportedUser.findByIdReportedUser", query = "SELECT r FROM ReportedUser r WHERE r.idReportedUser = :idReportedUser"),
    @NamedQuery(name = "ReportedUser.findByReason", query = "SELECT r FROM ReportedUser r WHERE r.reason = :reason"),
    @NamedQuery(name = "ReportedUser.findByReportDate", query = "SELECT r FROM ReportedUser r WHERE r.reportDate = :reportDate")})
public class ReportedUser implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idReportedUser")
    private Integer idReportedUser;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 200)
    @Column(name = "reason")
    private String reason;
    @Basic(optional = false)
    @NotNull
    @Column(name = "reportDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date reportDate;
    @JoinColumn(name = "idUser", referencedColumnName = "idUser")
    @ManyToOne(optional = false)
    private User idUser;

    public ReportedUser() {
    }

    public ReportedUser(Integer idReportedUser) {
        this.idReportedUser = idReportedUser;
    }

    public ReportedUser(Integer idReportedUser, String reason, Date reportDate) {
        this.idReportedUser = idReportedUser;
        this.reason = reason;
        this.reportDate = reportDate;
    }

    public Integer getIdReportedUser() {
        return idReportedUser;
    }

    public void setIdReportedUser(Integer idReportedUser) {
        this.idReportedUser = idReportedUser;
    }

    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    public Date getReportDate() {
        return reportDate;
    }

    public void setReportDate(Date reportDate) {
        this.reportDate = reportDate;
    }

    public User getIdUser() {
        return idUser;
    }

    public void setIdUser(User idUser) {
        this.idUser = idUser;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idReportedUser != null ? idReportedUser.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ReportedUser)) {
            return false;
        }
        ReportedUser other = (ReportedUser) object;
        if ((this.idReportedUser == null && other.idReportedUser != null) || (this.idReportedUser != null && !this.idReportedUser.equals(other.idReportedUser))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.extra.ReportedUser[ idReportedUser=" + idReportedUser + " ]";
    }

}
